package com.sky.mapper;

import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

/**
 * @Author by 孙有泽
 * @Date 2025/3/23 9:56
 * @Description
 */
@Mapper
public interface ShopCartMapper {


    List<ShoppingCart> queryCart(@Param("shoppingCart") ShoppingCart shoppingCart);
    @Update("update shopping_cart set number = #{number} where id = #{id}")
    void updateShopCart(ShoppingCart shoppingCart);

    void add(@Param("shoppingCart") ShoppingCart shoppingCart);
    @Delete("delete from shopping_cart where user_id = #{userId}")
    void clean(ShoppingCart shoppingCart);

    List<ShoppingCart> list(@Param("userId") Long userId);
}
